#  Copyright (c) 2020 - ~, WANGXI
#  
#  GRAMMA UNINTEST DELAY AWK FILE
#  Used in NS-2 simulator
#  Clone from https://gitee.com/WangXi_Chn/ns2_modulelib
#  Note in https://www.yuque.com/wangxi_chn/kozrfl
#  
#  Change Logs:
#  Date           Author       Notes			Mail
#  2020-11-24     WangXi   	   first version	WangXi_Chn@foxmail.com

BEGIN {
    largest_index = 0;
}

{
    action = $1; 
    time = $2;
    from = $3;
    to = $4;
    type = $5;
    pktsize_ = $6;
    flow_id = $8;
    src = $9;
    dst = $10;
    seq_no = $11;
    packet_id = $12;

    if(largest_index < seq_no){
        largest_index = seq_no;
    }
    if(action == "+" && from == 1){
        start_time[seq_no] = time;
    }
    if(action == "r" && to == 3){
        end_time[seq_no] = time;
    }
}

END {
    printf("the largest_index is %d\n",largest_index);
    for(i=0;i<largest_index;i++){
        printf("%d %f %f\n",i,end_time[i],start_time[i]);
    }
}
    
#/************************ (C) COPYRIGHT 2020 WANGXI **************END OF FILE****/
